✨ BCA JUL24 Batch ✨

Join Our WhatsApp Group

Anukasif Pic

4.2 - Functions in C - MCQs

Interactive MCQs Quiz

Test your knowledge with these questions

1. How are multidimensional arrays stored in memory?

2. What is the basic type of multiple dimensions array in C?

3. Which of the following is true about a 2D array in C?

4. How many loops are needed to traverse a 2D array in C?

5. Which matrix is called a rectangle matrix in a 2D array?

6. What is the valid declaration for a 2D array?

7. What is the default return type of a C function?

8. Which of the following does not return any value?

9. What is stored in a stack before calling a function?

10. Which of the following components form a function declaration?

11. What is the correct way to declare a 2D array without specifying the row size?

12. Which of the following will update an element in a 2D array?

13. What is the advantage of using functions in C?

14. Which function prototype is valid in C?

15. Which of the following allows functions to be reused in C?

16. What is a key benefit of subprograms?

17. Which of the following is incorrect about 2D array declaration?

18. Which operation is performed first when a function is called?

19. What is matrix multiplication in C?

20. How many loops are needed for matrix multiplication?

21. What is the default return type for a function in C if not specified?

22. Which of the following is the correct syntax for declaring a function with an argument but no return type?

23. Which of the following is true about function arguments in C?

24. How are formal parameters handled in a C function?

25. What is the correct syntax for calling a function with an argument in C?

26. Which of the following is a valid declaration for a function without arguments and without return value?

27. Which method passes a copy of an argument’s value to a function?

28. Which method passes the address of the argument to a function?

29. What happens to the actual parameter when using Call by Value?

30. Which of the following languages does not support Call by Reference by default?

31. Which statement is true for Call by Reference in C?

32. In which memory area are the local variables, including function arguments, stored in C?

33. What is the output of this code snippet?

void func(int *x) {
                *x = *x + 10;
            }
            int main() {
                int y = 5;
                func(&y);
                printf("%d", y);
                return 0;
            }

34. What will happen when you pass an array to a function in C?

35. Which of the following methods is used to modify a variable inside a function?

36. What is required to implement Call by Reference in C?

37. Which of the following functions returns the maximum of two numbers?

38. What will be the output of the following code?

void swap(int a, int b) {
                int temp = a;
                a = b;
                b = temp;
            }
            int main() {
                int x = 5, y = 10;
                swap(x, y);
                printf("%d %d", x, y);
                return 0;
            }

39. What is the primary difference between Call by Value and Call by Reference?

40. What does the return statement do in a function?

41. What are the two types of functions in C?

42. What is another name for a library function in C?

43. Which of the following is a library function?

44. What is the main advantage of using library functions in C?

45. Which of the following is an example of a user-defined function?

46. What header file is required for the sqrt() function?

47. Which of the following is true for user-defined functions?

48. Which function calculates the power of a number in C?

49. In which of the following situations would you use a user-defined function?

50. What is the main disadvantage of user-defined functions compared to library functions?

51. What is the purpose of the #include statement in C?

52. Which of the following is true about the function pow() in C?

53. Which of the following statements is correct for user-defined functions?

54. Which of the following is NOT a C library function?

55. Which function is used to find the square root of a number in C?

56. Which of the following is a major benefit of user-defined functions?

57. What is the output of the following program?

#include <stdio.h>
            int add(int a, int b) {
                return a + b;
            }
            int main() {
                int result = add(3, 4);
                printf("%d", result);
                return 0;
            }

58. What must be true for a function to be considered user-defined?

59. In which scenario would you most likely use a user-defined function instead of a library function?

60. Which statement about C library functions is false?

61. Which of the following is true about predefined functions?

62. Which of the following is NOT a predefined function in C?

63. Which of the following is NOT a part of a user-defined function in C?

64. What is the role of the return type in a function definition?

65. Which keyword is used as a return type if a function does not return any value?

66. What is a "parameter" in a function?

67. What is the main advantage of using user-defined functions?

68. In a user-defined function, what does the function body contain?

69. What is the correct order for defining a user-defined function in C?

70. Which of the following is an advantage of using functions in C?

71. In the function declaration int add(int, int);, what does int before add signify?

72. What is the purpose of function declaration in C?

73. Which of the following can be considered as an example of a user-defined function?

74. What must be included in the function definition?

75. Which of the following is NOT a characteristic of predefined functions?

76. What is the correct syntax for calling a user-defined function named calculate with two integer parameters a and b?

77. Which statement about function parameters is true?

78. Which of the following is an advantage of using functions in a program?

79. Which of the following describes a function call in C?

80. What is the output of the following program?

                    #include <stdio.h>
                    void greet() {
                        printf("Hello, World!");
                    }
                    int main() {
                        greet();
                        return 0;
                    }
                

81. Which of the following is true about user-defined functions?

82. What is the benefit of user-defined functions?

83. Which statement is true about user-defined functions?

84. What is the output of the following program?

                    #include <stdio.h>
                    int sum(int a, int b) {
                        return a + b;
                    }
                    int main() {
                        int a = 10, b = 20;
                        int result = sum(a, b);
                        printf("Sum is: %d", result);
                        return 0;
                    }
                

85. What is the function signature of the following user-defined function?

                    int multiply(int a, int b) {
                        return a * b;
                    }
                

86. In a user-defined function, what does the keyword return do?

87. Which part of the user-defined function contains the actual code?

88. In the given code, what is int sum(int a, int b) called?

                    int sum(int a, int b) {
                        return a + b;
                    }
                

89. Which of the following is an advantage of user-defined functions?

90. Which of the following correctly calls a function named add with arguments 5 and 10?

91. What is the output of the following code?

                #include <stdio.h>
                int multiply(int a, int b) {
                    return a * b;
                }
                int main() {
                    int x = 5, y = 6;
                    int result = multiply(x, y);
                    printf("Product is: %d", result);
                    return 0;
                }
                

92. Which of the following is necessary when defining a user-defined function?

93. What is a user-defined function in C?

94. Which of the following is a valid syntax for a function declaration in C?

95. What does the keyword 'void' indicate in a function declaration?

96. What is the default return type of a function in C?

97. What is recursion?

98. Which of the following problems is best solved using recursion?

99. Which of the following is an example of a library function in C?

100. What is the output of the following code?

                int main() {
                    int x = 5;
                    printf("%d", fact(x));
                    return 0;
                }
                int fact(int n) {
                    if (n == 0)
                        return 1;
                    else
                        return n * fact(n - 1);
                }
                

101. What is the key difference between call by value and call by reference?

102. Which of the following function types does not return any value?

103. Which of the following is necessary for recursion to work properly?

104. Which of the following is true about recursion?

105. In C, which header file is required to use the library function pow()?

106. What is a function prototype in C?

107. What is the termination condition in recursion called?

108. Which function call method allows the actual value to remain unchanged in the calling function?

109. Which of the following library functions is used to find the length of a string?

110. What happens if a recursive function lacks a base case?

111. Which type of variable stores the return address of the function call in recursion?

112. What is the primary advantage of recursion over iteration?

113. What is a function in C programming?

114. Which of the following is a built-in function in C?

115. Which header file is required for using printf() and scanf() functions?

116. Which function call method allows the actual value to remain unchanged in the calling function?

117. Which function in C is used to allocate memory dynamically?

118. In C, which keyword is used to declare a function returning no value?

119. What is the default return type of a function in C if no return type is explicitly declared?

120. How many times can the main() function be called in a C program?

121. Which function is used to compare two strings in C?

122. Which of the following is the correct syntax to declare a function in C?

123. Which of these is a valid function declaration in C?

124. Which function would you use to find the length of a string in C?

125. What is recursion in C?

126. Which of the following functions can change the value of the actual parameters passed to it?

127. Which function is used to open a file in C?

128. What is the return type of the malloc() function in C?

129. Which C function is used to get the length of an array?

130. Which function is used to release the memory allocated dynamically in C?

131. Which of the following is a function that does not return any value?

132. What does the return keyword do in a function?